<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>首页sx</title>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/jquery-1.8.3.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/autosize.js"></script>
<style type="text/css">
.outdiv {
	height: 100%;
	width: 100%;
	background-color: green;
}

#all {
	height: 100%;
	width: 100%;
}

.divtrcontent {
	width: 100%;
}

.divtrtitle {
	width: 100%;
}

.tdsep {
	display: inline-block;
	height: 100%;
	width: 20%;
	margin: 0;
	padding: 0;
}
</style>

<script type="text/javascript">
	$(function() {
		init();

		/*text自适应高度*/
		autosize(document.querySelectorAll('textarea'));

		initevent();
	});

	/*结构初始化*/
	function init() {
		var arr = new Array();
		var tmp = new Array();
		/*初始化*/
		if (false) {
			tmp = new Array();
			arr.push(tmp);
			tmp[0] = "扫码跳转-装维界面/用户界面";
			tmp[1] = "/facilitatorCode/qrcode";
			tmp[2] = {};
		} else {
			tmp = new Array();
			arr.push(tmp);
			tmp[0] = "手工跳转-初始化装维界面或者用户界面数据";
			tmp[1] = "/qrcode/qrcodeCheck";
			tmp[2] = {
				"data" : {
					'code' : 'dQzXDmbOO' //二维码串号
				}
			}; //对象参数
		}

		/*装维app登录*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-app登录";
		tmp[1] = "/staffInfo/fromApp";
		tmp[2] = {
			"data" : {
				'staffId' : '251324',
				'sessionId' : 'qyp0OIBU8pxlYaIsGbVUj9QBOfEP04P8czHJ6TRG89XShY_v0wYi!-462422961!1518073315412',
				'orderId' : '878555'
			}
	
	};
		
		/*获取测试码*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "获取测试码";
		tmp[1] = "/qrcode/queryQrcode";
		tmp[2] = {
			"data" : {
				'batchId' : '0', //批次号
				'status' : '1', //状态
				'showWay' : '0' //显示方式1长传
				
				}
		};
		
		/*获取首页图片*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "获取首页图片";
		tmp[1] = "/intelligentCheck/getCarouselPictureList";
		tmp[2] = {};

		/*码加密更新*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "码加密-更新";
		tmp[1] = "/update/sql";
		tmp[2] = {
			"data" : {
				'way' : 'en', //en,加密 de解密
				'tablename' : '2' //表名
			}
		};
		
		/*获取详情信息*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "在途单评价";
		tmp[1] = "/appOrder/detail";
		tmp[2] = {
			"data" : {
				'serOrderId' : '1232', //流水订单号
				'type' : '2', //类型
				'workOrderId' : '2' //工单号
			}
		};
		
		
		/*获取工单信息*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "获取工单信息";
		tmp[1] = "/workOrder/getByWorkOrderId";
		tmp[2] = {
			"data" : {
				'workOrderId' : '2' //工单号
			}
		};
		
		/*评价上传*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "评价上传";
		tmp[1] = "/remote/esync";
		tmp[2] = {
			"data" : {
				'productType' : '2' //产品类型
			}
		};
		
		/*工单同步*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "工单同步";
		tmp[1] = "/remote/osync";
		tmp[2] = {
			"data" : {
				'serWorkOrder' : '879512' ,//工单号
				'type' : '2' //1 装移，2障碍
			}
		};
		

		/*自服*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "自服-智慧检测";
		tmp[1] = "/intelligentCheck/check";
		tmp[2] = {
			"data" : {
				'productType' : '2' //产品类型
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "自服-智慧检测2";
		tmp[1] = "/intelligentCheck/newCheck";
		tmp[2] = {
			"data" : {
				'productType' : '2' //产品类型
			}
		};
		/*装维*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-获取所有区域";
		tmp[1] = "/areaCode/findAll";
		tmp[2] = {};

		/*查询用户*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-查询用户信息";
		tmp[1] = "/qrcode/getMaintainInfoByTelNo";
		tmp[2] = {
			"data" : {
				'userAccount' : '02901013890', //用户账号
				'productType' : '2', //产品类型
				'areaCode' : '290' //区域码
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "自服-自助排障";
		tmp[1] = "/barrierRemove/remove";
		tmp[2] = {};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-账号密码登录";
		tmp[1] = "/qrcode/passwordCheck";
		tmp[2] = {
			"data" : {
				'account' : '1111', //装维人员账号
				'phone' : '666', //装维人员手机号码
				'areaCode' : '5gg55', //装维人员区号
				'password' : '', //装维人员密码,没有则不传递
				'code' : '556413' //验证码
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-验证码登录";
		tmp[1] = "/qrcode/phoneCheck";
		tmp[2] = {
			"data" : {
				'account' : '1111', //装维人员账号
				'phone' : '666', //装维人员手机号码
				'areaCode' : '5gg55', //装维人员区号
				'password' : '', //装维人员密码,没有则不传递
				'code' : '556413' //验证码
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-账号查询";
		tmp[1] = "/qrcode/getMaintainInfoByTelNo";
		tmp[2] = {
			"data" : {
				'account' : '1111', //装维人员账号
				'phone' : '666', //装维人员手机号码
				'areaCode' : '5gg55', //装维人员区号
				'password' : '', //装维人员密码,没有则不传递
				'code' : '556413' //验证码
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-选择设备品牌";
		tmp[1] = "/qrcode/selectDeviceBrand";
		tmp[2] = {
			"data" : {
				"deviceType" : "1" //设备类型 光纤/猫
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-选择设备型号";
		tmp[1] = "/qrcode/selectDeviceMode";
		tmp[2] = {
			"data" : {
				'deviceBrand' : '创维', //设备品牌
				'deviceType' : '1', //设备类型 光纤/猫
			}
		};

		var tmp = new Array();
		arr.push(tmp);
		tmp[0] = "装维-绑定设备";
		tmp[1] = "/qrcode/bind";
		tmp[2] = {
			"data" : {
				"deviceMode" : "17r1r2", //设备型号
				"deviceBrand" : "dd3dd", //设备品牌
				"qrcode" : "1111", //二维码串，纯字符串码信息
				"userAccount" : "1111", //用户账户
				"staffNo" : "11222", //装维人员工号
				"areaCode" : "11222", //用户区号
				'deviceModeId' : '444', //设备Id
				'productType' : '1' //产品类型
			}
		};

		/*账户换绑*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "绑定-换绑";
		tmp[1] = "/qrcode/change";
		tmp[2] = {
			"data" : {
				"areaCode" : "290",
				"deviceBrand" : "TP-LINK",
				"deviceMode" : "TL-GP112",
				"deviceModeId" : "73",
				"oldqrcode" : "ftNJlVsOO",
				"oldstatus" : "9",
				"olduserAccount" : "029014274569",
				"productType" : "2",
				"qrcode" : "oOceHhv5I",
				"staffNo" : "",
				"userAccount" : "029014274569"
			}
		};

		/*工单*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "工单-申报工单";
		tmp[1] = "/applyBarrierBill/apply";
		tmp[2] = {
			"data" : {
				"barrierDesc" : "无法上网", //故障描述
				"barrierType" : "0", //故障类型0：无法上网，1：网速慢
				"userName" : "tom",
				"mobile" : "13838389438"
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "工单-催促在途工单";
		tmp[1] = "/intelligentCheck/urge";
		tmp[2] = {
			"data" : {
				"orderId" : "1247", //故障单id
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "工单-取消工单";
		tmp[1] = "/workOrder/workOrderCancel";
		tmp[2] = {
			"data" : {
				"workOrderId" : '1247' //工单id
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "工单-某个用户工单列表";
		tmp[1] = "/workOrder/getWorkOrderByUserAcct";
		tmp[2] = {
			"data" : {
				"userAccount" : "OX6530930" //用户账户
			}
		};
		
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "工单-某个用户工单列表";
		tmp[1] = "/workOrder/getWorkOrderByTodoUserName";
		tmp[2] = {
			"data" : {
				"qrcode" : "HOfjE3XoQXY2NHOLXPBgWQ==",
				"latnId" : "290",
				"productType" : "2",
				"userAccount" : "029014231113"
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "工单-获取工单状态";
		tmp[1] = "/workOrder/getWorkOrderStatus";
		tmp[2] = {
			"data" : {
				"workOrderId" : "1" //工单id
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "工单-某个工单详情";
		tmp[1] = "/workOrder/getWorkOrderDetail";
		tmp[2] = {
			"data" : {
				"workOrderId" : "1" //工单id
			}
		};

		/*评价*/
		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "评价-新增工单评价";
		tmp[1] = "/evaluate/evaluationByUser";
		tmp[2] = {
			"data" : {
				"starLevel" : {
					"fwtdScode" : "4",
					"gnjmScode" : "4",
					"yxScode" : "3",
					"zlScode" : "4"
				}, //标签id,多个标签用逗号隔开		(选填)
				"custDesc" : "非常好,一下子就解决了问题", //评价描述					(选填)
				"staffNo" : "3123", //装维人员id					(必填)
				"workOrderId" : "1247" //对应工单id					(必填)
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "评价-评价标签列表";
		tmp[1] = "/evaluateTag/getEvaluateTagList";
		tmp[2] = {
			"data" : {
				"starLevel" : "3" //星级,3表示查看3星标签	  (必填)
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "评价-查看自己对装维人员的评价";
		tmp[1] = "/evaluate/viewEvaluationByUser";
		tmp[2] = {
			"data" : {
				"workOrderId" : "1247" //对应工单id					(必填)
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "评价-查看装维人员信息(综合评价)";
		tmp[1] = "/evaluate/viewStaffDetail";
		tmp[2] = {
			"data" : {
				"workOrderId" : "1247" //对应工单id					(必填)
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "用户-修改密码";
		tmp[1] = "/crmUserInfo/modifyPasswd";
		tmp[2] = {
			"data" : {
				'checkCode' : '1454', //验证码
				'passWord' : '12341324' //新密码
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "用户-缴费";
		tmp[1] = "/toChargePage";
		tmp[2] = {
			"data" : {
				"oweAmount" : "1111"
			}
		};

		tmp = new Array();
		arr.push(tmp);
		tmp[0] = "手机-发送验证码";
		tmp[1] = "/identifyingCode/sendIdentifyingCode";
		tmp[2] = {
			"data" : {
				"phone" : "13267158278"
			}
		};

		/*-----------------------------------------------------------------------*/
		for ( var i in arr) {
			var lab = arr[i][0];
			var url = arr[i][1];
			var par = JSON.stringify(arr[i][2]);

			var tlab = "<span aligin='right' class='tdsep'>" + i + lab
					+ "</span>";
			var turl = "<a class='tdsep' id='lab" + i
					+ "' href='javascript:void(" + i + ")'>" + url + "</a>";
			var tpar = "<textarea rows='8' class='tdsep' id='par"+i+"'>" + par
					+ "</textarea>";
			var tre = "<textarea rows='8' class='tdsep' id='re"+i+"'></textarea>";

			var temp = "<div  class='divtrcontent'>" + tlab + turl + tpar + tre
					+ "</div>";

			$("#all").append(temp + "<hr/>");
		}

		/*绑定事件*/
		testallevent(arr);
	}

	function initevent() {
		$("a").on("click", function() {
			/*url*/
			var strurl = $(this).text();

			/*参数*/
			var strpar = $(this).next().val();

			/*返回值区域*/
			var re = $(this).next().next();

			$.ajax({
				type : "POST",
				url : "${pageContext.request.contextPath}" + strurl,
				data : strpar,
				success : function(msg) {
					re.val(msg);
				}
			});
		});
	}

	/*一键测试*/
	function testallevent(arr) {
		$("#testall").on("click", function() {
			$("#resultid").html("");
			for ( var i in arr) {
				var turl = arr[i][1];
				var tpar = JSON.stringify(arr[i][2]);
				var tre = JSON.stringify(arr[i][3]);
				$.ajax({
					async : false, /*必须设置为同步*/
					type : "POST",
					url : "${pageContext.request.contextPath}" + turl,
					data : tpar,
					success : function(msg) {
						$("#re" + i).html(msg);
						if ("000000" != JSON.parse(msg).resCode) {
							$("#resultid").append(i + ",");
						}
					}
				});
			}
		});
	}
</script>

</head>
<body>
	<h1 align="center" style="background-color: gold;">接口测试</h1>
	"${pageContext.request.session.id}"
	<input id='testall' type="button" value="testall" />
	<span id="resultid"></span>
	<div class="outdiv">
		<div class="divtrtitle">
			<span class='tdsep'>lab标题</span> <span class='tdsep'>url链接</span> <span
				class='tdsep'>par参数</span> <span class='tdsep'>re返回</span>
		</div>
		<div id="all"></div>
	</div>
</body>
</html>